let mongoose = require('mongoose');

let schema = new mongoose.Schema({
    diamond:{
        type:Number,
        default:10
    },
    goldCoin:{
        type:Number,
        default:0
    }
});

schema.methods={
    getMessage(){
        return {
            diamond:this.diamond,
            goldCoin:this.goldCoin
        }
    },
    //视频自动加金币
    async addGoldCoin(options={count:'100'}){
        this.goldCoin+=parseInt(options.count);
    },
    async getDiamond(options){
        this.diamond+=50;
        //await options.self.save();
    },
    async getGoldCoin(options){
        this.goldCoin+=50;
        //await options.self.save();
    }
};

module.exports=schema;